<?php
namespace app\index\controller;

use app\common\controller\HomeBase;
use think\Db;
use think\facade\Config;

class Article extends HomeBase
{
    public function index()
    {
        $item_id = (int)$this->request->param("item_id");
        $item = model("article")->where(['id' => $item_id])->find();

        if (empty($item)) {
            $this->error("文章不存在");
        }

        $category = model("category")->where(['id' => $item['cid']])->find();
        $this->site_seo("article",['title' => $item['title'],'category_name' => $category['name']]);

        return $this->fetch("index",['item' => $item]);
    }

}
